// this script checks if a content area is suitable for columnar text
// if a content area is too long, then columns will be annoying for users
// to read, but if it's short enough, the whole article can fit into a screen
// (say, a 13" laptop screen), and columns will make it prettier and eaier to read
$(function() {

	// if the sidebar is empty, remove it and expand the text area
	// check for object / any other item
	// make sure not to remove sidebar on really long articles, as the text becomes hard to read
	/*
	if ($('#sidebar').children().text().trim().length < 1 &&
		$('#sidebar').find('object').length < 1 &&
		$('#content').height() < (window.innerHeight - 200)) 
	{
		$('#sidebar').remove();
		$('#content').parent().removeClass('ninecol');
		$('#content').parent().removeClass('eightcol');
		$('#content').parent().addClass('twelvecol');
	}
	*/
	
	// don't columnize for articles with object: youtube embeds, issuu embeds, etc. (looks bad)
	if ($('#content').height() < (window.innerHeight - 200) && $('#content').find('object').length < 1) {
		// use 3 columns for full width articles. 2 for 2/3 width articles
		/*
		if ($('#content').width() > 1000) {
			$('#content').css({
				'-moz-column-count' : '3',
				'-moz-column-gap' : '30px',
				'-webkit-column-count' : '3',
				'-webkit-column-gap' : '30px',
				'column-count' : '3',
				'column-gap' : '30px'
			});
		} else {*/
			$('#content').css({
				'-moz-column-count' : '2',
				'-moz-column-gap' : '30px',
				'-webkit-column-count' : '2',
				'-webkit-column-gap' : '30px',
				'column-count' : '2',
				'column-gap' : '30px'
			});
		/*}*/
	}
});